<!DOCTYPE html>
<html>
<head>
    <meta charset="<?php echo $cfg_soft_lang; ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>栏目管理</title>
    <link href="../static/web/css/admin2.css" rel="stylesheet" type="text/css">
    <script src="js/global.js"></script>
    <script src="js/context_menu.js"></script>
    <script src="js/ieemu.js"></script>
    <script src="js/dialog.js"></script>
    <script src="../static/web/js/webajax2.js"></script>
    <script>
        function LoadSuns(ctid, tid) {
            if ($DE(ctid).innerHTML.length < 1) {
                $DE('img' + tid).src = 'images/dedecontract.gif';
                var myajax = new DedeAjax($DE(ctid));
                myajax.SendGet('catalog_do.php?dopost=GetSunLists&cid=' + tid);
            }
            else {
                showHide(ctid, tid);
            }
        }

        function showHide(objname, tid) {
            if ($DE(objname).style.display == "none") {
                $DE('img' + tid).src = 'images/dedecontract.gif';
                $DE(objname).style.display = BROWSER.firefox ? "" : "block";
            } else {
                $DE('img' + tid).src = 'images/dedeexplode.gif';
                $DE(objname).style.display = "none";
            }
        }

        if (moz) {
            extendEventObject();
            extendElementModel();
            emulateAttachEvent();
        }


        //封面模板
        function CommonMenuPart(eobj, obj, tid, tname) {
            var popupoptions
            popupoptions = [
                new ContextItem("管理内容", function () {
                    location = "catalog_do.php?cid=" + tid + "&dopost=listArchives";
                }),
                new ContextSeperator(),
                new ContextItem("预览分类", function () {
                    window.open("<?php echo $cfg_phpurl; ?>/list.php?tid=" + tid);
                }),
                new ContextItem("更新HTML", function () {
                    location = "makehtml_list.php?cid=" + tid;
                }),
                new ContextItem("获取JS文件", function () {
                    location = "catalog_do.php?cid=" + tid + "&dopost=GetJs";
                }),
                new ContextSeperator(),
                new ContextItem("增加子类", function () {
                    location = "catalog_add.php?id=" + tid;
                }),
                new ContextItem("更改栏目", function () {
                    location = "catalog_edit.php?id=" + tid;
                }),
                new ContextSeperator(),
                new ContextItem("移动栏目", function () {
                    location = 'catalog_move.php?job=movelist&typeid=' + tid
                }),
                new ContextItem("删除栏目", function () {
                    location = "catalog_del.php?id=" + tid + "&typeoldname=" + tname;
                }),
                new ContextSeperator(),
                new ContextItem("向上排前一级", function () {
                    location = "catalog_do.php?cid=" + tid + "&dopost=upRank";
                }),
                new ContextItem("关闭菜单(<u>C</u>)", function () {
                })
            ]
            ContextMenu.display(eobj, popupoptions)
        }

        //跳转栏目
        function SingleMenu(eobj, obj, tid, tname) {
            var popupoptions
            popupoptions = [
                new ContextItem("更改栏目", function () {
                    location = "catalog_edit.php?id=" + tid;
                }),
                new ContextSeperator(),
                new ContextItem("移动栏目", function () {
                    location = 'catalog_move.php?job=movelist&typeid=' + tid
                }),
                new ContextItem("删除栏目", function () {
                    location = "catalog_del.php?id=" + tid + "&typeoldname=" + tname;
                }),
                new ContextSeperator(),
                new ContextItem("向上排前一级", function () {
                    window.location = "catalog_do.php?cid=" + tid + "&dopost=upRank";
                }),
                new ContextItem("关闭菜单(<u>C</u>)", function () {
                })
            ]
            ContextMenu.display(eobj, popupoptions)
        }
    </script>
    <style>
        .coolbg2 {
            border:1px solid #000000;
            background-color:#F2F5E9;
            height:18px
        }

        .coolbt2 {
            border-left:2px solid #EFEFEF;
            border-top:2px solid #EFEFEF;
            border-right:2px solid #ACACAC;
            border-bottom:2px solid #ACACAC;
            background-color:#F7FCDA
        }

        .nbline {
            border-bottom:1px solid #d6d6d6;
            background-color:#FFFFFF;
        }

        .bline2 {
            border-bottom:1px solid #d6d6d6;
            background-color:#F9FCEF;
        }

        .yixiaowan td {
            line-height:40px;
        }

        .yixiaowan td a {
            padding:0 3px;
            font-size:15px;
        }

        .yixiaowan td a:hover {
            color:#51acf9;
        }

        .coolbg {
            font-size:14px;
        }

        .coolbg:hover, .coolbt:hover {
            color:#fff;
            background:#28a745;
        }

        .ke-sou:hover {
            background:#28a745;
            border:1px solid #28a745 !important;
        }

        .np {
            display:none;
        }

        .bline a img {
            display:none;
        }

        .bline img {
            position:relative;
            left:13px;
        }

        .nbline a img {
            display:none;
        }

        input {
            outline:none;
        }

        .layui-border-box {
            box-sizing:border-box;
            width:98%;
            margin:0 auto;
        }

        .layui-table-header {
            border-width:0 0 1px;
            overflow:hidden;
            border-style:solid;
            border-color:#e6e6e6;
            background-color:#f2f2f2;
            box-sizing:border-box;
        }

        .layui-table-header .layui-table {
            margin-bottom:-1px;
        }

        .layui-table {
            width:100%;
            background-color:#fff;
            color:#666;
        }

        .layui-table-view .layui-table td, .layui-table-view .layui-table th {
            padding:13px 0;
            border-top:none;
            border-left:none;
        }

        .layui-table th {
            font-weight:bold;
        }

        .layui-table td, .layui-table th {
            position:relative;
            padding:9px 15px;
            min-height:20px;
            line-height:20px;
            font-size:14px;
        }

        .layui-table th {
            text-align:left;
        }

        .layui-table-view, .layui-table td {
            border-width:1px;
            border-style:solid;
            border-color:#e6e6e6;
        }

        .layui-table-cell {
            padding:0 5px;
            font-size:16px;
        }

        .layui-table thead tr {
            background-color:#f2f2f2;
        }

        .layui-btn-container a {
            background-color:#999;
            color:#fff;
            padding:10px;
            border-radius:5px;
        }

        .layui-btn-container a:hover {
            background-color:#333;
            color:#fff;
        }

        .layui-table tr:hover {
            background-color:#f5f5f5;
        }

        .layui-table-cell .link {
            background-color:#5192ca;
            color:#fff;
            padding:10px;
            border-radius:5px;
        }

        .layui-table-cell .link:hover {
            background-color:#333;
            color:#fff;
        }

        .layui-table th {
            border-width:1px;
            border-style:solid;
            border-color:#e6e6e6;
        }

        .layui-table-view:last-child {
            border-bottom:0;
        }

        .layui-btn-container2 {
            float:right;
        }

        .list_type_box {
            float:left;
        }

        .layui-table .list_type {
            line-height:50px;
            border-bottom:1px solid #e6e6e6;
            padding:0 20px 0 6%;
            overflow:hidden;
            border-right:1px solid #e6e6e6;
        }

        .layui-table .list_type:hover {
            background-color:#fff;
            border-right:1px solid #e6e6e6;
        }

        .layui-table .list_type a {
            font-size:16px;
        }

        .layui-table .list_type a:hover {
            color:#039;
            text-decoration:underline;
        }

        .layui-table .list_type span {
            color:#999;
            margin-left:5px;
        }

        .layui-btn-container2 a {
            color:#fff;
            background-color:#333;
            font-size:14px;
            padding:3px 10px;
            border-radius:3px;
        }

        /*其他样式*/
        #edit {
            color:#fff;
            background-color:#03a193;
            font-size:14px;
            padding:3px 10px;
            border-radius:3px;
            text-decoration:none !important;
        }

        #preview {
            color:#fff;
            background-color:#3f8bb4;
            font-size:14px;
            padding:3px 10px;
            border-radius:3px;
            text-decoration:none !important;
        }

        #delete {
            color:#fff;
            background-color:#333;
            font-size:14px;
            padding:3px 10px;
            border-radius:3px;
            text-decoration:none !important;
        }

        #edit:hover {
            background-color:#05c3b2;
        }

        #preview:hover {
            background-color:#58acda;
        }

        #delete:hover {
            background-color:#000;
        }
    </style>
    <script type="text/javascript">
        function checkSubmit() {
            if (document.form3.kcss.value == '') {
                document.form3.kcss.focus();
                alert("请输入关键词");
                return false;
            }
        }
    </script>
</head>
<body leftmargin='8' topmargin='8' onLoad="ContextMenu.intializeContextMenu()">

<table width="98%" border="0" cellpadding="3" cellspacing="0" bgcolor="#cfcfcf" align="center">
    <tr>
        <td height="28" style="padding:20px 0;background:#fff;">
            <div style="float:left">
                <form action="jjTypeSearch.php" name='form3' onSubmit="return checkSubmit();">
                    <input name="q" value="" autocomplete="off" placeholder="搜栏目，快速直达..." id="kcss" style="float:left;width:150px;line-height:40px;padding:0 10px;border-radius:3px;font-size:14px;display:inline-block;margin-right:5px;"/>
                    <input type="submit" value="搜索" class="ke-sou" style="border:none;line-height:40px;border-radius:3px;padding:0 10px;border:1px solid #51acf9;">
                </form>
            </div>
            <div style="float:right;">
                <a href='catalog_add.php?listtype=all' class='coolbg' style="line-height:40px;padding:0 10px;border-radius:3px;display:inline-block;">增加栏目</a>
                <input type="button" name="sb1" value="排序更新" style="margin-left:10px;line-height:40px;padding:0 10px;border-radius:3px;border:none;" class="coolbt" onClick="document.form1.submit();"/>
            </div>
        </td>
    </tr>
</table>

<form name='form1' method='post' action='catalog_do.php?dopost=upRankAll'>
    <div class="gzs-lanmu-tishi" style="width:98%;margin:0 auto;height:18px;line-height:18px;font-size:12px;color:#999;">
        展开➕号，点击它，可以显示二级类目。展开没有信息出来的，说明该栏目，没有设置二级类目。
    </div>
    <div class="layui-border-box layui-table-view" style="margin-top:10px;">
        <div class="layui-table-box">
            <div class="layui-table-header">
                <table cellspacing="0" cellpadding="0" border="0" class="layui-table">
                    <thead>
                    <tr align="center">
                        <th width="4%">
                            <div class="layui-table-cell laytable-cell-1-0-0" align="center">展开</div>
                        </th>
                        <th width="84%">
                            <div class="layui-table-cell laytable-cell-1-0-2">栏目名称</div>
                        </th>
                        <th width="8%">
                            <div class="layui-table-cell laytable-cell-1-0-10" align="center">二级类目</div>
                        </th>
                        <th width="4%">
                            <div class="layui-table-cell laytable-cell-1-0-10" align="center">排序</div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>

            <div class="layui-table-body">
                <?php
                if(empty($opendir)) $opendir=-1;
                if($userChannel>0) $opendir=$userChannel;
                $tu = new TypeUnit();
                $tu->ListAllType($userChannel,$opendir);
                ?>
            </div>

        </div>
    </div>
</form>
<script src="/static/web/js/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(document).on('click','.pagelistbox a',function () {
            var totalCount = $(this).data('totalcount');
            var id = $(this).data('id');
            var page = $(this).data('page');

            $.ajax({
                url: 'catalog_do.php?dopost=GetSunLists&cid=' + id + '&page=' + page + '&totalcount=' + totalCount,
                type: 'GET',
                success: function(result) {
                    $('#suns' + id).html(result);
                }
            });
        });

    });
</script>
</body>
</html>